package coreservlets.ch9;

public class ItemOrder {
	private CatalogItem item;
	private int numItems;
	//---------------------------constructor
	public ItemOrder(CatalogItem item) {
		setItem(item);
		setNumItems(1);
	}
	//-----------------------------getter and setter
	public void setItem(CatalogItem item) {
		this.item = item;
	}
	public CatalogItem getItem() {
		return item;
	}
	public void setNumItems(int numItems) {
		this.numItems = numItems;
	}
	public int getNumItems() {
		return numItems;
	}
	public String getItemID(){
		return this.item.getItemID();
	}
	public String getShortDescription(){
		return this.item.getShortDescription();
	}
	public String getLongDescrption(){
		return this.item.getLongDescription();
	}
	public double getUnitCost(){
		return this.item.getCost();
	}
	public void incrementItems(){
		this.numItems += 1;
	}
	public void cancelOrder(){
		this.numItems = 0;
	}
	public double getTotalCost(){
		return this.numItems * getUnitCost();
	}
}
